import {createSlice} from '@reduxjs/toolkit' // 初始数据类型
import {Themes} from '@/theme/types' // 初始数据类型

// 初始数据类型
export interface themeModeState {
  mode: Themes
}

// 初始数据
const initialState: themeModeState = {
  mode: Themes.DARK
}
//
export const themeSettingReducer = createSlice({
  name: 'themeSetting',
  initialState,
  reducers: {
    toggle(state) {
      state.mode = state.mode === Themes.DARK ? Themes.LIGHT : Themes.DARK
    }
  }
})

// export const { toggle } = themeSettingReducer.actions
export default themeSettingReducer.reducer
